import {CardType} from '../../../common/cards/CardType';
import {IProjectCard} from '../IProjectCard';
import {CardName} from '../../../common/cards/CardName';
import {CardRenderer} from '../render/CardRenderer';
import {Tag} from '../../../common/cards/Tag';
import {IPlayer} from '../../IPlayer';
import {ActionCard} from '../ActionCard';
import {all} from '../Options';

export class ExploitationOfVenus extends ActionCard implements IProjectCard {
  constructor() {
    super({
      name: CardName.EXPLOITATION_OF_VENUS,
      type: CardType.ACTIVE,
      cost: 6,
      tags: [Tag.VENUS, Tag.CRIME],

      action: {
        spend: {
          corruption: 1,
        },
        global: {
          venus: 1,
        },
      },

      metadata: {
        cardNumber: 'U099',
        renderData: CardRenderer.builder((b) => {
          b.effect('Whenever ANY player terraforms Venus 1 step, THEY also gain 2 MC.', (eb) => {
            eb.venus(1, {all}).startEffect.megacredits(2, {all}).asterix;
          });
          b.br;
          b.action('Pay 1 corruption to terraform Venus 1 step.', (ab) => {
            ab.corruption(1).startAction.venus(1);
          });
        }),
      },
    });
  }

  public override bespokePlay(player: IPlayer) {
    player.game.exploitationOfVenusInEffect = true;
    return undefined;
  }

  public override onDiscard(player: IPlayer): void {
    player.game.exploitationOfVenusInEffect = false;
  }
}
